/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package bsc.war.service;

import javax.naming.InitialContext;
import javax.naming.NamingException;

/**
 *
 * @author memozac
 */
public class ServiceLocator {
    
    private InitialContext ic;
    private static ServiceLocator _instance;
    
    
    static {
        try{
            _instance = new ServiceLocator();
        }catch(Exception es){
            es.printStackTrace(System.err);
        }
    }
    
    private ServiceLocator()throws Exception {
        try {
            ic = new InitialContext();
        } catch (Exception ne) {
            throw new RuntimeException(ne);
        }
    }
    
    static public ServiceLocator getInstance(){
        return _instance;
    }
    
    public Object lookup(String jndiName) throws NamingException {
        return ic.lookup(jndiName);
    }
}

